#include <iostream>
#include <vector>

using std::cout;
using std::endl;
using std::vector;

int main(int argc, char **argv)
{
    vector<int> ivec;

    ivec.push_back(1);
    ivec.push_back(2);
    ivec.push_back(3);
    ivec.push_back(4);

    /**
     * 迭代器使用解引用获取指向的元素
     */
    for (auto iter = ivec.begin(); iter != ivec.end(); iter++)
        cout << *iter << endl;

    for (auto iter = ivec.cbegin(); iter != ivec.cend(); iter++)
        cout << *iter << endl;

    return 0;
}